home *** CD-ROM | disk | FTP | other *** search
-
- package sub_arctic.lib;
-
- import java.awt.Rectangle;
-
- /** Traversal transformer that takes a Rectangle in parent coordinates and
- * transforms it into a child object's coordinates. The transformed object
- * must be a Rectangle.
- *
- * @see sub_arctic.lib.interactor#traverse_and_collect
- */
- public class xform_rect_to_child implements traversal_xform {
- /** Perform the transformation.
- *
- * @param Object parent_parameters a Rectangle object in parent
- * coordinates.
- * @param interactor child_obj the child object.
- * @param int child_indx the index of that child.
- * @return a Rectangle at the same position, but expressed in the child's
- * coordinates.
- */
- public Object xform(
- Object parent_parameters,
- interactor child_obj,
- int child_index)
- {
- Rectangle parent_rect;
-
- if (!(parent_parameters instanceof Rectangle))
- throw new sub_arctic_error("Rectangle object was expected, but not found");
-
- /* extract the parent rectangle */
- parent_rect = (Rectangle)parent_parameters;
-
- /* transform the position into local coordinates of the child */
- return new Rectangle(child_obj.x_into_local(parent_rect.x),
- child_obj.y_into_local(parent_rect.y),
- parent_rect.width, parent_rect.height);
- }
-
- //had:
- //*@exception sub_arctic.exception.bad_value thrown if the parent_parameters
- //* parameter is not a Rectangle.
- };
- /*=========================== COPYRIGHT NOTICE ===========================
-
- This file is part of the subArctic user interface toolkit.
-
- Copyright (c) 1996 Scott Hudson and Ian Smith
- All rights reserved.
-
- The subArctic system is freely available for most uses under the terms
- and conditions described in
- http://www.cc.gatech.edu/gvu/ui/sub_arctic/sub_arctic/doc/usage.html
- and appearing in full in the lib/interactor.java source file.
-
- The current release and additional information about this software can be
- found starting at: http://www.cc.gatech.edu/gvu/ui/sub_arctic/
-
- ========================================================================*/
-